package com.nine.mymall.auth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 官方推荐直接实现 WebMvcConfigurer 或者直接继承 WebMvcConfigurationSupport，
 * 方式一实现WebMvcConfigurer接口（推荐），
 * 方式二继承WebMvcConfigurationSupport类
 * @author: duonine
 * @date: 2021/12/7
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 默认跳转到登录页面
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login.html").setViewName("login");
        registry.addViewController("/reg.html").setViewName("reg");
    }
}
